<div class="properties-rows">
	<div class="row"><?php foreach ($listings as $listing) { ?> 
		<?php 
		//get media for listing
		$media = $this->mdl_listingmapmodel->get_media($listing['Listing_ID'], "Cover", 1);
		
		?>
		<div class="property span9">
			<div class="row">
			<div class="image span3">
				<div class="content">
					<?php if(isset($media->FileName) && isset($media->FileExtension)) { ?>
					<a href="<?php base_url(); ?>detail/<?php echo $listing['Link']; ?>"><img src="<?php echo $this->config->item('HTTP_LISTING_MEDIA_IMAGE') . $listing['Listing_ID'] . '/' . $media->FileName . '-270x200' . $media->FileExtension; ?>" alt=""></a> 
					<?php } else { ?> 
					<img src="<?php echo $this->config->item('HTTP_IMAGE'); ?>tmp/no-image.png" alt=""> 
					<?php } ?>
				</div>
				<!-- /.price -->
			</div>
			<!-- /.image -->
			
			<div class="body span6">
				<div class="title-price row">
					<div class="title span4">
						<h2><a href="detail/<?php echo $listing['Link']; ?>"><?php echo $listing['ProjectName']; ?></a></h2>
					</div>
					<!-- /.title -->
					<div class="social">
						<div class="review">
							<div class="share"><!-- AddThis Button BEGIN -->
								<div class="addthis_default_style">
									<a class="addthis_button_facebook"
								        addthis:url="<?php echo base_url(); ?>detail.html?id=<?php echo $listing['Listing_ID']; ?>"
								        addthis:title="<?php echo $listing['ProjectName']; ?>"
								        addthis:description="<?php echo $listing['ProjectName']; ?>">
								    </a> 
									<a class="addthis_button_twitter"
										addthis:url="<?php echo base_url(); ?>detail.html?id=<?php echo $listing['Listing_ID']; ?>"
								        addthis:title="<?php echo $listing['ProjectName']; ?>"
								        addthis:description="<?php echo $listing['ProjectName']; ?>">
									</a>
									<a class="addthis_button_email"
										addthis:url="<?php echo base_url(); ?>detail.html?id=<?php echo $listing['Listing_ID']; ?>"
								        addthis:title="<?php echo $listing['ProjectName']; ?>"
								        addthis:description="<?php echo $listing['ProjectName']; ?>">
									</a>
								</div>
								<script type="text/javascript"
									src="//s7.addthis.com/js/250/addthis_widget.js">
								</script> <!-- AddThis Button END -->
							</div>
						</div>
					</div>
				</div>
				<!-- /.title -->
				
				<div class="w-box-content-3 cnt_a property-detail view-property-list">
					<div class="row-fluid">
						 <div class="span6">
						 	<ul class="span12">
								<li class="">
									<p class="sepH_a"><span class="lblproject"><?php echo $text_price; ?>: </span>
									<?php if($listing['Price_Min'] > 0) { ?> 
										<?php echo $listing['PriceUnit'] . " " . number_format(($listing['Price_Min']), 0, '.', ','); ?>
									<?php } else { ?> 
										<?php echo "Price on Application"; ?> 
									<?php } ?>
									</p>
								</li>
								<li class="">
									<?php 
										//get Tenure Name by Id
									$tenureObj = $this->lookupmodel->getTenure($this->config->item('config_language_id'), $this->config->item('market'), $listing['Listing_ID']);
									$tenureName = isset($tenureObj->Name) ? $tenureObj->Name : "";
									?>
									<p class="sepH_a">
										<span class="lblproject"><?php echo $text_propertytype; ?>: </span>
										<?php echo $listing['PropertyType'] ?>
									</p>
								</li>
							</ul>
						 </div>
						 <div class="span6">
						 	<ul class="span12">
						 		<li class="">
									<div class="row-fluid field-item-convertor">
										<?php if($listing['Price_Min'] > 0) { ?>
										<?php
											//$price_usd = $listing['Price_Min'] * IDR_TO_USD;
                                                                                        $price_usd = $listing['PriceUsd'];
											//$price_usd_formatted = USD_UNIT . " " . number_format(($price_usd), 0, '.', ',');
											
											//get rate of current currecy (which is comparate with USD)
											$rate = $this->helpermodel->getRateByUnitCurrency($listing['PriceUnit']);	
											$price_usd = $listing['Price_Min'] / $rate;
											$price_usd_formatted = USD_UNIT . " " . number_format(($listing['Price_Min'] / $rate), 0, '.', ',')
										?>
										<div class="pull-left span8 spanusd field-item-txt">
											Estimated <?php echo $price_usd_formatted; ?>
										</div>
										<div class="pull-right span4 field-item-ddl">
											<select name="curencyid" class="curencyid_ajax span12">
												<option value="AUD">AUD</option>
												<option value="CNY">CNY</option>
												<option value="EUR">EUR</option>
												<option value="GBP">GBP</option>
												<option value="HKD">HKD</option>
												<option value="IDR">IDR</option>
												<option value="INR">INR</option>
												<option value="JPY">JPY</option>
												<option value="NZD">NZD</option>
												<option value="SGD">SGD</option>
												<option value="THB">THB</option>
												<option value="USD" selected="selected">USD</option>
												<option value="VND">VND</option>
											</select>
										</div>
										<span class="price asking_price_local_int" style="visibility: hidden;with:0px;height: 0px;position: absolute">
											<?php echo $listing['PriceUnit'] . " " . number_format(($listing['Price_Min']), 0, '.', ','); ?>
					                    </span>
										<span class="price_usd" style="visibility: hidden;with:0px;height: 0px;position: absolute"><?php echo trim($price_usd); ?>
					                   	</span>
					                   	<span class="unit_price" style="visibility: hidden;with:0px;height: 0px;position: absolute"><?php echo $listing['PriceUnit']; ?></span>
					                   	<?php } else { ?>
					                   	<div class="pull-left span12 spanusd field-item-txt">
											Estimated Price on Application
										</div>
					                   	<?php } ?>
									</div>
									<!-- /.content -->
								</li>
								<li class="">
									<p class="sepH_a"><span class="lblproject"><?php echo $text_size_default; ?>: </span>
									<?php if($list_type == "land" && isset($listing['LandArea'])) { ?>
									<?php echo number_format($listing['LandArea']) . ' ' . $listing['SizeUnit']; ?>
									<?php } else { ?>
									<?php echo number_format($listing['Size_Min']) . ' ' . $listing['SizeUnit']; ?>
									<?php } ?>
									</p>
								</li>
							</ul>
						 </div>
					</div>	
					<div class="formSep">
					 	<div class="row-fluid">
					 		<?php if(isset($listing['Latitude']) && isset($listing['Longitude'])) { ?>
					 		<div class="span1 pull-left">
                             	<a class="opendetail gmap sepH_b" href="<?php echo "detail/map_pop/". $listing['Link']; ?>">
                             		<div class="gmap sepH_b"></div>
                             	</a>
					 		</div>
					 		<?php } ?>
					 		<div class="span8">
								<div class="control-group" style="margin-bottom: 0px;">
									<div class="controls">
										<div class="bedrooms bedrooms_result sepH_b">
											<div class="content"><?php echo $listing['Bedroom']; ?></div>
										</div>
										<div class="bathrooms bathrooms_result sepH_b">
											<div class="content"><?php echo $listing['Bathroom']; ?></div>
										</div>
									</div>
								</div>
					 		</div>
					 	</div>
					</div>
				</div>
				<div class="w-box-content-4">
					<div class="pull-right morelinks">						
						<button class="btn btn-primary view_detail">View Detail</button>
                                                <?php if(in_array($listing['Listing_ID'], $shortlist) ) {?>
                                                <button class="btn btn-primary short_list disabled">Shortlisted</button>
                                                <?php } else { ?>
						<button class="btn btn-primary short_list">Shortlist</button>
                                                <?php } ?>
						<!--<input type="hidden" value="<?php //echo $listing['Listing_ID']; ?>" name="morelinks" id="morelinks">-->
						<input type="hidden" value="<?php echo $listing['Link']; ?>" name="morelinks" id="morelinks">
					</div>
					<div class="clearfix"></div>
				</div>
			</div>
			<!-- /.body --></div>
		<!-- /.property -->
		</div>
		<!-- /.row --> <?php } ?>
	</div>
<!-- /.row -->
</div>
<!-- /.properties-rows -->
